menuInfo = (state={},action)->
  switch action.type
    when 'MENU_INFO/GET_MENU_START'
      Object.assign {},state,{isLoading:true}
    when 'MENU_INFO/GET_MENU_FAIL'
      global.SaveAppData()
      defaultMenu =
        [{"gnid":"hxjg","gnmc":"航行警告","sortid":"0"},{"gnid":"yhsj","gnmc":"引航数据","sortid":"0"},{"gnid":"zygg","gnmc":"重要公告","sortid":"0"},{"gnid":"jkdd","gnmc":"进口调度","sortid":"1"},{"gnid":"ckdd","gnmc":"出口调度","sortid":"2"},{"gnid":"ybdd","gnmc":"移泊调度","sortid":"3"},{"gnid":"jkjh","gnmc":"进口计划","sortid":"4"},{"gnid":"ckjh","gnmc":"出口计划","sortid":"5"},{"gnid":"ybjh","gnmc":"移泊计划","sortid":"6"}]
      Object.assign {},state,{menuItems:defaultMenu,isLoading:false}
    when 'MENU_INFO/GET_MENU_COMPLETED'
      global.SaveAppData()
      Object.assign {},state,{menuItems:action.payload,isLoading:false}
    else
      state

module.exports = menuInfo
